<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
	<link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
	<link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
	<!-- <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />-->
	<![endif]-->
	<title>征信测试</title>
</head>
<body>
<div class="contant">
<div class="row">
	<div class="panel panel-default">
		<div class="panel-body">
			<form id="my-form" class="form-horizontal" method="post">
			    <div class="form-group">
			        <label class="col-sm-3 control-label">userid<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="userid" value="256" readonly>
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">applyId：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="applyId" value="">
			        </div>
			    </div>
			    <div class="form-group">
		            <label class="col-sm-3 control-label">姓名：</label>
		            <div class="col-sm-4">
			        	<input class="form-control required" name="name" value="">
		            </div>
		            <small>请不要使用英文状态下的单双引号</small>
		        </div>
		        <div class="form-group">
			        <label class="col-sm-3 control-label">身份证号：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="idty" value="">
			        </div>
			    </div>
				<div class="form-group">
			        <label class="col-sm-3 control-label">手机号：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="mobile" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人1：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact1Name" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人1电话：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact1Mobile" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人1关系：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact1Relationship" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人2：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact2Name" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人2电话：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact2Mobile" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">联系人2关系：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="contact2Relationship" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">首次提交时间：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input readonly type="text" class="form-control required" name="firstCommitTime" value="{$nowTime}">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">配偶姓名：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="mateName" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">配偶手机：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="mateMobile" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">配偶身份证：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="mateIdty" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">配偶工作单位：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="company" value="">
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">配偶地址：<span class="c-red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="address" value="">
			        </div>
			    </div>
		        <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-5">
				        <button class="btn btn-primary" type="submit">校验征信</button>
				       	<a href="{:U('Index/index')}"><button class="btn btn-default" type="button">返回</button></a>
				       	<input id="check-result" class="btn btn-warning" type="button" value="查看结果">
				       	<h3 id="show-result" class="sr-only" style="display: inline; color: red;">hello</h3>
			       	</div>
		       	</div>
			</form>
		</div>
	</div>
</div>
</div>
<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
	$('#check-result').click(function(){
		applyId = $('input[name="applyId"]').val();
		$.ajax({
           type: "POST",
           url: "__URL__/check_result",
           data: {applyId:applyId},
           success: function(msg){
            obj_data = $.parseJSON(msg);
            console.log(obj_data.lr[0]);

            strNote = '';
            if (obj_data.lr[0] == "" || obj_data.lr[0] == undefined || obj_data.lr[0] == null) {
            	strNote = '暂无该applyId对应的信息';
            }else{
	            switch(obj_data.lr[0].applyResult){
					case '000': strNote  = '审批通过';break;
					case '0001': strNote = '审批中';break;
					case '0002': strNote = '审批拒绝';break;
					case '0003': strNote = '存在法院非经济案件';break;
	            }
	            strNote += obj_data.lr[0].applyResultReason;
            }

            $('#show-result').html(strNote).removeClass('sr-only');
           }
        });
	});

	$("#my-form").submit( function () {
		userid               = $('input[name="userid"]').val();
		applyId              = $('input[name="applyId"]').val();
		name                 = $('input[name="name"]').val();
		idty                 = $('input[name="idty"]').val();
		mobile               = $('input[name="mobile"]').val();
		contact1Name         = $('input[name="contact1Name"]').val();
		contact1Mobile       = $('input[name="contact1Mobile"]').val();
		contact1Relationship = $('input[name="contact1Relationship"]').val();
		contact2Name         = $('input[name="contact2Name"]').val();
		contact2Mobile       = $('input[name="contact2Mobile"]').val();
		contact2Relationship = $('input[name="contact2Relationship"]').val();
		firstCommitTime      = $('input[name="firstCommitTime"]').val();
		mateName             = $('input[name="mateName"]').val();
		mateMobile           = $('input[name="mateMobile"]').val();
		mateIdty             = $('input[name="mateIdty"]').val();
		company              = $('input[name="company"]').val();
		address              = $('input[name="address"]').val();

		$.ajax({
           type: "POST",
           url: "__URL__/credit_check",
           data: {
           		userid:userid,
           		applyId:applyId,
           		name:name,
           		idty:idty,
           		mobile:mobile,
           		contact1Name:contact1Name,
           		contact1Mobile:contact1Mobile,
           		contact1Relationship:contact1Relationship,
           		contact2Name:contact2Name,
           		contact2Mobile:contact2Mobile,
           		contact2Relationship:contact2Relationship,
           		firstCommitTime:firstCommitTime,
           		mateName:mateName,
           		mateMobile:mateMobile,
           		mateIdty:mateIdty,
           		company:company,
           		address:address
           	},
           success: function(msg){
            obj_data = $.parseJSON(msg);
            console.log(obj_data);
            strNote ='';
            switch(obj_data['applyResult']){
				case '000': strNote  = '审批通过';break;
				case '0001': strNote = '审批中';break;
				case '0002': strNote = '审批拒绝';break;
				case '0003': strNote = '存在法院非经济案件';break;
            }

            $('.page-header').html('征信测试接口---<font color="red">'+strNote+'</font>');
            alert(strNote);

            // var html = '<option value="0">一级菜单</option>';
            // $(data).each(function(i, v){
            //     html += '<option value="' + v.id + '">' + v.name + '</option>';
            // });
            // $('#myform select').html(html);

           }
        });
	  return false;
	} );

</script>